<html>
<head>
    <title>智能图书平台</title>
    <style>
    * {
        box-sizing: border-box;
        font-family: Arial, sans-serif;
    }

    body {
	   background-image: url('./static/002.jpg');
    	   background-size: cover;
        background-color: #f0f2f5;
        margin: 0;
        padding: 0;
    }

    .addbook-container {
        max-width: 400px;
        margin: 5% auto;
        padding: 20px;
        background-color: #fff;
        border-radius: 5px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    h1 {
        text-align: center;
        margin-bottom: 20px;
    }

    form {
        display: flex;
        flex-direction: column;
    }

    label {
        font-weight: bold;
        margin: 10px 0 5px;
    }

    input {
        padding: 10px;
        border: 1px solid #ccc;
        border-radius: 4px;
        outline: none;
    }

    input:focus {
        border-color: #007bff;
    }

    button {
        margin-top: 20px;
        padding: 10px;
        background-color: #007bff;
        color: #fff;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-weight: bold;
    }

    button:hover {
        background-color: #0056b3;
    }
    .center-text {
            bottom: 15px; /* 根据需要调整 */
    	   	 left: 50%;
    	 	 transform: translate(-50%, 50%);
   	 	 color: black;
    	 	 font-size: 15px;
	  }
</style>
</head>
<body>
    <div class="addbook-container">
        <h1>添加新书</h1>
        {% if message == '书籍已存在,请重新输入' or message == '书籍信息为空，请重新输入'%}
        <div id="message" hidden="true">{{message}}</div>
        {% endif %}
        <script>
            const message = document.getElementById('message').innerHTML
            alert(message)
        </script>
        {%if booknum == 0%}
        <form method="post" action="{{ url_for('addnumer') }}">
        <label for="number">请输入你要添加图书的数量</label>
        <input type="text" name="number" id="number">
        <button type="submit" id="addnumer">提交</button>
        </form>
        {%endif%}
        {%if booknum!= 0 %}
        {% if message == '插入成功'%}
        <div id="message2" hidden="true">{{message}}</div>
        {% endif %}
        <script>
            const message2 = document.getElementById('message2').innerHTML
            alert(message2)
        </script>
        {% for i in range(booknum)%}
        <form method="post" action="{{ url_for('add_book') }}">
            <label for="title">书名</label>
            <input type="text" name="title" id="title">
            <label for="author">作者</label>
            <input type="text" name="author" id="author">
            <label for="img_url">图书图片路径</label>
            <input type="text" name="img_url" id="img_url">
            <label for="img_url">图书简介信息</label>
            <input type="text" name="book_img_message" id="book_img_message">
        {% endfor %}
        <button type="submit" id="add_book">一键添加</button>
        </form>
        {%endif%}
    </div>
	<div class="center-text">图书管理系统&nbsp&nbsp&nbsp&nbsp<a href="https://www.scvtc.edu.cn/index.htm" target="_blank" style="color: black; text-decoration: none; border-bottom: 1px solid black;">四川职业技术学院</a>&nbsp&nbsp&nbsp&nbsp黄俊杰团队产品</div>
</body>
</html>

